package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.JtDistributorRatingMapper;
import com.ruoyi.business.domain.JtDistributorRating;
import com.ruoyi.business.service.IJtDistributorRatingService;
import com.ruoyi.common.core.text.Convert;

/**
 * 分销商评分Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2025-05-22
 */
@Service
public class JtDistributorRatingServiceImpl implements IJtDistributorRatingService 
{
    @Autowired
    private JtDistributorRatingMapper jtDistributorRatingMapper;

    /**
     * 查询分销商评分
     * 
     * @param ratingId 分销商评分主键
     * @return 分销商评分
     */
    @Override
    public JtDistributorRating selectJtDistributorRatingByRatingId(Long ratingId)
    {
        return jtDistributorRatingMapper.selectJtDistributorRatingByRatingId(ratingId);
    }

    /**
     * 查询分销商评分列表
     * 
     * @param jtDistributorRating 分销商评分
     * @return 分销商评分
     */
    @Override
    public List<JtDistributorRating> selectJtDistributorRatingList(JtDistributorRating jtDistributorRating)
    {
        return jtDistributorRatingMapper.selectJtDistributorRatingList(jtDistributorRating);
    }

    /**
     * 新增分销商评分
     * 
     * @param jtDistributorRating 分销商评分
     * @return 结果
     */
    @Override
    public int insertJtDistributorRating(JtDistributorRating jtDistributorRating)
    {
        jtDistributorRating.setCreateBy(ShiroUtils.getSysUser().getUserName());
        jtDistributorRating.setCreateTime(DateUtils.getNowDate());
        return jtDistributorRatingMapper.insertJtDistributorRating(jtDistributorRating);
    }

    /**
     * 修改分销商评分
     * 
     * @param jtDistributorRating 分销商评分
     * @return 结果
     */
    @Override
    public int updateJtDistributorRating(JtDistributorRating jtDistributorRating)
    {
        return jtDistributorRatingMapper.updateJtDistributorRating(jtDistributorRating);
    }

    /**
     * 批量删除分销商评分
     * 
     * @param ratingIds 需要删除的分销商评分主键
     * @return 结果
     */
    @Override
    public int deleteJtDistributorRatingByRatingIds(String ratingIds)
    {
        return jtDistributorRatingMapper.deleteJtDistributorRatingByRatingIds(Convert.toStrArray(ratingIds));
    }

    /**
     * 删除分销商评分信息
     * 
     * @param ratingId 分销商评分主键
     * @return 结果
     */
    @Override
    public int deleteJtDistributorRatingByRatingId(Long ratingId)
    {
        return jtDistributorRatingMapper.deleteJtDistributorRatingByRatingId(ratingId);
    }
}
